// pages/my/cash/affirmRecharge.js
const App = getApp()

Page({
  data: {
    show: !0,
    form: {
      name: '',
      is_def: 0,
    },
  },
  onLoad() {
    this.address = App.HttpResource('/address/:id', { id: '@id' })
  },


  submitForm(e) {
    const params = e.detail.value

    console.log(params)

    /**
        App.WxService.showModal({
          title: '支付结果',
          content: '支付成功',
          showCancel: 1,
        })
     */



    wx.showModal({
      title: '支付结果',
      content: '支付成功',
      showCancel:false,
      success: function (res) {
        if (res.confirm) {
          console.log('支付成功')
          wx.navigateBack({
            delta: 2
          })
        }
      }
    })

    // App.HttpService.postAddress(params)
    /**
    this.address.saveAsync(params)
      .then(res => {
        const data = res.data
        console.log(data)
        if (data.meta.code == 0) {
          this.showToast(data.meta.message)
        }
      })
     */



    //App.WxService.navigateTo('/pages/my/cash/cash')



  },
  showToast(message) {
    App.WxService.showToast({
      title: message,
      icon: 'success',
      duration: 1500,
    })
      .then(() => App.WxService.navigateBack())
  },
})